Use a map instead of two lists for $service-colors

Akinori MUSHA 9 anni fa
parent
commit
7f4afe0027
1 ha cambiato i file con 10 aggiunte e 7 eliminazioni
  1. 10 7
      app/assets/stylesheets/application.css.scss.erb

+ 10 - 7
app/assets/stylesheets/application.css.scss.erb

@@ -264,17 +264,20 @@ h2 .scenario, a span.label.scenario {
264 264
   width: 200px;
265 265
 }
266 266
 
267
-$services:            twitter     37signals   github      tumblr      dropbox   wunderlist;
268
-$service-colors:      #55acee     #8fc857     #444444     #2c4762     #007EE5   #ED5F27;
267
+$service-colors: (
268
+  twitter:      #55acee,
269
+  37signals:    #8fc857,
270
+  github:       #444444,
271
+  tumblr:       #2c4762,
272
+  dropbox:      #007EE5,
273
+  wunderlist:   #ED5F27
274
+);
269 275
 
270 276
 @mixin services {
271
-  @each $service in $services {
272
-    $i: index($services, $service);
273
-    $service-color: nth($service-colors, $i);
274
-
277
+  @each $service, $color in $service-colors {
275 278
     &.service-#{$service} {
276 279
       color: #fff;
277
-      background-color: $service-color;
280
+      background-color: $color;
278 281
     }
279 282
   }
280 283
 }